#include <ios>
#include <iostream>
#include <list>
#include <set>
#include <vector>
#include "command_line_parser.hpp"

int main(int argc, const char** argv)
{
    xncc::options::command_line_parser parser;
    parser.add_option("I,ids", xncc::options::value<std::vector<int>>()->default_value({1}), "id list")
        .add_option("f,float", xncc::options::value<double>()->default_value(1.000), " a float value ")
        .add_option("n,name", xncc::options::value<std::string>(), "name information")
        .add_option("S,strs", xncc::options::value<std::vector<std::string>>(), "str list")
        .add_option("s,switch", xncc::options::value<bool>()->default_value(false), "switch value")
        .add_option("num", xncc::options::value<long long>(), "a num");
    parser.parse(argc, argv);

    if (parser.exist("float")) {
        std::cout << "a float value : " << parser.get_option_value<double>("f") << std::endl;
    }

    if (parser.exist("s")) {
        std::cout << "switch : " << std::boolalpha << parser.get_option_value<bool>("switch") << std::endl;
    }

    std::cout << "name : " << parser.get_option_value<std::string>("name", "xxxxx") << std::endl;

    std::cout << "num : " << parser.get_option_value<long long>("num", 12345) << std::endl;

    if (parser.exist("I")) {
        auto ids = parser.get_option_value<std::vector<int>>("I");
        for (auto id : ids) {
            std::cout << "id:" << id << std::endl;
        }
    }

    if (parser.exist("strs")) {
        auto strs = parser.get_option_value<std::vector<std::string>>("strs");
        for (auto str : strs) {
            std::cout << "str:" << str << std::endl;
        }
    }

    if (parser.exist("help")) {
        std::cout << parser.help_string() << std::endl;
    }
    return 0;
}